package com.cm.log_process.log_common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.data.elasticsearch.client.TransportClientFactoryBean;
import org.springframework.stereotype.Component;

/**
 * @Author shenwanlong
 * @Date 2020/2/19
 */
@Component
public class TransportClientFactory {

    @Value("${spring.data.elasticsearch.cluster-name}")
    private String ClusterName;
    @Value("${spring.data.elasticsearch.cluster-nodes}")
    private String ClusterNodes;

    @Bean
    public TransportClientFactoryBean factoryBean(){
        System.out.println("ClusterName = " + ClusterName);
        System.out.println("ClusterNodes = " + ClusterNodes);
        TransportClientFactoryBean factoryBean = new TransportClientFactoryBean();
        factoryBean.setClusterName(ClusterName);
        factoryBean.setClusterNodes(ClusterNodes);
        return factoryBean;
    }
}
